package sifeap.bl.ejb.convenios;

import java.util.List;

import javax.ejb.EJB;
import javax.ejb.Stateless;

import sifeap.dal.ejb.convenios.ConvenioDALLocal;
import sifeap.entities.convenios.Convenio;
import sifeap.exception.SifeapException;

/**
 * Session Bean implementation class EventoBL
 */
@Stateless(name="ConvenioBL")
public class ConvenioBL implements ConvenioBLLocal {

	@EJB
	private ConvenioDALLocal convenioDAL;
	
    /**
     * Default constructor. 
     */
    public ConvenioBL() {}

	@Override
	public boolean crear(Convenio convenio) throws SifeapException {
		try{
			convenioDAL.crear(convenio);
			return true;
		}catch (Exception e) {
			throw new SifeapException(e);
		}
	}

	@Override
	public List<Convenio> buscarTodos() throws SifeapException {
		try{
			return convenioDAL.buscarTodos();
		}catch (Exception e) {
			throw new SifeapException(e);
		}
	}

	@Override
	public boolean modificar(Convenio convenio) throws SifeapException {
		try {
			convenioDAL.modificar(convenio);
			return true;
		} catch (Exception e) {
			throw new SifeapException(e);
		}
	}

	@Override
	public boolean eliminar(Convenio convenio) throws SifeapException {
		try {
			convenioDAL.eliminar(convenio);
			return true;
		} catch (Exception e) {
			throw new SifeapException(e);
		}
	}

	@Override
	public Convenio buscar(Object id) throws SifeapException {
		try {
			return convenioDAL.buscar(id);
		} catch (Exception e) {
			throw new SifeapException(e);
		}
	}
	
	@Override
	public boolean remover(Convenio convenio) throws SifeapException {
		try {
			convenioDAL.remover(convenio);
			return true;
		} catch (Exception e) {
			throw new SifeapException(e);
		}
	}
}
